<template>
	<view class="content">
		<view class="main">
			<scroll-view scroll-y="true" @scroll="handleScroll" style="height: 1px; flex: 1;" show-scrollbar="false">
				<!-- <loading :loadingIsShow="loadingIsShow" v-if="!isrefresher"></loading>
				<view v-show="!loadingIsShow"> -->
				<!-- 这里是页面其他内容 -->
				<view class="content-top" :style="bgOpacity" :class="{ fixed_top: scrolling }">
					<view class="top_title" :class="{ top_display :!scrolling }" :style="titleTop"><img
							src="https://17lelife-bucket.oss-cn-beijing.aliyuncs.com/WeChat-App-Picture/find_act.png"
							style="width: 20px; height: 20px; margin-right: 5px;" />
						<view>17乐生活</view>
					</view>
				</view>

				<!-- 滚动部分 -->
				<view class="scrollMain_box">
					<!-- 背景图轮播哦 -->
					<view class="sur_box_bg">
						<swiper class="top_swiper" autoplay="false" :indicator-dots="true"
							indicator-active-color="#FFFFFF" :indicator-width="20" ref="webpage"
							@change="changeSwiper($event)" :current="currentSwiper">
							<swiper-item v-for="(swiper_item, index) in topSwiperList" :id="index" :key="index" class="swiper_item">
								<img :src="swiper_item.bannerImage" alt="">
							</swiper-item>
						</swiper>
						<view class="swiper-dots-box" ref="swiper">
							<span class="article" v-for="(item, index) in topSwiperList" :key="index" @click="swiperDot(index)" :class="{ active: currentDot === index }"></span>
						</view>
					</view>

					<view class="service_wrap_box" :style="scrollMT">
						<view class="tabs_box">
							<view class="top-tabs">
								<view v-for="(a, indexT) in sortList" :key="indexT" class="box">
									<view class="top-tab-item" :class="{ active: activeIndex == indexT, 'actL': activeIndex == indexT && indexT === 0, }" @click="onTabClick(indexT, $event)">
										{{ a.sortName }}
									</view>
									<!-- 'actR': activeIndex == indexT && indexT === sortList.length - 1,
							'actM': activeIndex == indexT && indexT !== 0 && indexT !== sortList.length - 1 -->
								</view>
							</view>
						</view>
						<view class="serviceContentBox">
							<view class="serviceContent-wrap" :class="{
								'service_border_radiusL': activeIndex === 0, 'service_border_radiusR': activeIndex === sortList.length - 1,
								'service_border_radius': activeIndex !== 0 && activeIndex !== sortList.length - 1
							}">
								<view class="serviceContent" @click=toServiceDetail(1)>
									<img class="service_icon" src="https://17lelife-bucket.oss-cn-beijing.aliyuncs.com/WeChat-App-Picture/find/zhongdian.png" alt="" />
									<view class="service_name">钟点服务</view>
								</view>
								<view class="serviceContent" @click=toServiceDetail(2)>
									<img class="service_icon" src="https://17lelife-bucket.oss-cn-beijing.aliyuncs.com/WeChat-App-Picture/find/clean.png" alt="" />
									<view class="service_name">全屋清扫</view>
								</view>
								<view class="serviceContent" @click=toServiceDetail(3)>
									<img class="service_icon" src="https://17lelife-bucket.oss-cn-beijing.aliyuncs.com/WeChat-App-Picture/find/kitchen.png" alt="" />
									<view class="service_name">厨房保洁</view>
								</view>
								<view class="serviceContent" @click=toServiceDetail(4)>
									<img class="service_icon" src="https://17lelife-bucket.oss-cn-beijing.aliyuncs.com/WeChat-App-Picture/find/jiadian.png" alt="" />
									<view class="service_name">家电清洗</view>
								</view>
								<view class="serviceContent" @click=toServiceDetail(5)>
									<img class="service_icon" src="https://17lelife-bucket.oss-cn-beijing.aliyuncs.com/WeChat-App-Picture/find/guandao.png" alt="" />
									<view class="service_name">管道疏通</view>
								</view>

							</view>
						</view>
					</view>

					<!-- 17拼团活动 -->
					<view class="pinTuan" v-if="groupBuyData.length>0">
						<view class="pinTuan_title">
							<view class="act_title">
								<view class="act_title_text">17拼团</view>
								<img class="act_title_img" src="https://17lelife-bucket.oss-cn-beijing.aliyuncs.com/WeChat-App-Picture/find/pintuan.png" alt="" />
							</view>
							<view class="act_more" @click="toMorePinTuan">
								<span class="r5 act_t" style="display: inline-block;">查看更多</span><van-icon name="arrow" />
							</view>
						</view>
						<view class="pinTuan_content" v-for="(item, index) in groupBuyData.slice(0, 3)" :key="index"
							@click="goBuy(item)">
							<view class="box_content b13 act_display">
								<view class="content_img"><img :src="item.image" alt="" mode="widthFix" /> </view>
								<view class="content_text pintuanContent_text">
									<view class="content_text_title text_title t1">{{ item.groupBuyingName }}</view>
									<view class="content_text_bottom">
										<view class="bottom_left">
											<template v-if="item.labelList && item.label.labelList !== 0 && item.label !== null">
												<view class="content_text_tips_box">
													<view class="content_text_tips" v-for="(j, k) in item.labelList" :key="k" style="display: inline-block;">
														<span class="tips_span">{{ j.name }}</span>
													</view>
												</view>
											</template>
											<!-- <view
												v-if="item.labelList && item.labelList.length !== 0 && item.label !== null" style="display: flex; align-items: center;">
												<view class="content_text_tips" v-for="(j, k) in item.labelList" :key="k" >{{ j.name }} </view>
											</view> -->
											<view class="content_text_progress" :class="{ 't7': !item.labelList || item.labelList.length === 0 }">
												<van-progress
													:percentage="Number((item.groupBuyingProductOrderCount/item.groupBuyingProductCount) * 100).toFixed(0)"
													stroke-width="9px" color="#F1551C" track-color="#E7E7E7"
													show-pivot="false" show-info="false"
													:class="{'hide-before': (item.groupBuyingProductCount === 0|| (Number((item.groupBuyingProductOrderCount/item.groupBuyingProductCount) * 100).toFixed(0)==0))}" />
												<span class="progress_span">
													热抢 {{ item.groupBuyingProductCount === 0? 0 : Number((item.groupBuyingProductOrderCount/item.groupBuyingProductCount) * 100).toFixed(0) }}%
												</span>

											</view>
										</view>
										<!-- <view class="bottom_right" @click="goBuy()"> -->

										<view class="goBuy_icon" v-if="currentTime<item.startTime || item.groupBuyStatus=='未开始'"> 未开始</view>
										<view class="goBuy_icon" @click.stop="goBuy(item)" v-else-if="(currentTime>item.startTime && currentTime<item.stopTime) || item.groupBuyStatus=='进行中'">去抢购 </view>
										<view class="goBuy_icon" @click="goBuy()" v-else-if="(currentTime>item.stopTime) || item.groupBuyStatus=='已结束'">已结束 </view>

										<!-- </view> -->
									</view>
								</view>
							</view>
						</view>
					</view>

					<!-- 同城活动 -->
					<view class="activity" v-if="actContent.length>0">
						<!-- <view class="act_tabs white">
							<view class="tabbar-item" v-for="(item, index) in tabData"
								@click="changeTabs(index, $event, item.typeName)"
								:class="{ active: index === tabCurIndex, option: tabCurIndex === 0, }" :key="index"
								:id="index">
								<template> {{ item.typeName }} </template>
							</view>
						</view> -->
						<view class="activity_title">
							<view class="act_title">社区活动</view>
							<view class="act_more" @click="toMoreActivities">
								<span class="r5 act_t" style=" display: inline-block;"> 查看更多</span><van-icon name="arrow" />
							</view>
						</view>
						<template>
							<view class="activity_content  ">
								<view class="box_content sj_bg" v-for="(i, j) in actContent.slice(0, 3)" :key="j" @click="toActivityDetail(i)">
									<view class=" act_display">
										<view class="content_img"><img :src="i.image" alt="" mode="widthFix"></view>
										<view class="content_text sj_text">
											<view class="content_text_title sj_title">{{ i.activities.title }}</view>
											<view class="content_text_subtitle "> {{ i.monthAndDay }} {{i.weekDay}}  {{ i.times}}</view>
											<view class="content_text_address">{{ i.activities.addressDetail }}</view>
										</view>
									</view>
								</view>
							</view>
						</template>
					</view>
					<!-- <van-button @click="requestLocation">获取当前位置</van-button> -->
					<!-- 商家入驻 -->
					<view class="business" v-if="businessData.length>0">
						<view class="business_bg" v-for="(item, index) in businessData.slice(0, 3)" :key="index"
							@tap="toMerchantInfo(item)">
							<view class="business_box_content_left ">
								<img :src="item.imgUrl" alt="" mode="widthFix" />
							</view>
							<view class="business_box_content_right ">
								<view class="business_box_content_right_L content_text">
									<!-- <view class=""> -->
									<view class="content_text_title">{{ item.merchantName }}</view>
									<view class="content_sj_date b9">
										<span class="sj_status">{{ item.openBusiness?'营业中':'休息中'  }} </span>
										<span class="sj_date" v-if="item.openBusiness">{{ item.businessHours }}</span>
									</view>
									<view class="content_sj_address"> 
										<img src="https://17lelife-bucket.oss-cn-beijing.aliyuncs.com/WeChat-App-Picture/position.png" style="width: 18rpx; height: 24rpx;margin-right: 12rpx;" />
										<!-- <van-icon name="location" size="12"/> -->
										<view class="sj_text business_address">{{ item.address }}</view>
									</view>
									<!-- </view> -->
								</view>
								<view class="business_box_content_right_R ">
									<view class="phone_icon t2">
										<img src="https://17lelife-bucket.oss-cn-beijing.aliyuncs.com/WeChat-App-Picture/phone.png" style="width: 32rpx;height:32rpx;" />
									</view>
									<view class="door">{{ item.communityDoorName }}</view>
									<view class="distance t5">距您 {{ item.distance}}</view>
								</view>
							</view>
						</view>
					</view>
					<!-- 为您推荐 -->
					<view class="forYou">
						<view class="hotSale_title"></view>
					</view>

					<!-- logo -->
					<view class="logo_img t20"> </view>
				</view>
				<!-- </view> -->
			</scroll-view>
		</view>
		<tabBar :activeNav="activeNav"></tabBar>
		 <!-- 新增定位授权弹窗 -->
		<van-popup :show="popupShow" position="bottom" round @click-overlay="closePopup" :mask-click="false" ref="locationPopup"
			custom-style="width: 100%;overflow:scroll;background:#ffffff;">
			<view class="auth-popup">
                <!-- <image src="/static/location-auth.png" class="popup-icon"></image> -->
                <text class="popup-title">需要您的位置信息</text>
                <text class="popup-desc">获取周边生活服务，推荐最近商户</text>
                <button class="auth-btn" @tap="handleAuthLocation">立即授权</button>
                <text class="close-btn" @tap="closePopup">暂不需要</text>
            </view>
		</van-popup>
	</view>
</template>

<script>


import { topStyleWhite, topStyleBlack } from '@/utils/topColor'
import { checkLocationValid } from '@/utils/locationUtils'
import { tabBar } from '@/mycomponents/tabBar'
import { getFindApi } from '@/api/find'
import {scanActivityApi,getActivityListApi} from '@/api/activity'
import { getGroupBuyingPagingQueryApi } from '@/api/find'
import { getPageMerchantListApi } from '@/api/business'
import loading from '@/mycomponents/loading.vue'
import { formattedDate,formatTimeToDate } from "@/utils/timeUtils"; // 根据实际路径引入工具函数
import {recordCollection} from "@/utils/recordCollection"
import  {PAGE_TYPE} from '@/utils/constant'
export default {
	components: {
		tabBar,
		loading,
	},
	data() {
		return {
            isrefresher: false,
            loadingIsShow: true,
            loadingIsShowPage: true,
			title: 'Hello111',
			scrolling: false, // 顶部区域吸顶效果
			bgOpacity: '',
			scrollMT: '',
			value1: 0,
			value2: 'a',
			activeNav: 0,   //底部tab
			// currentIndex:0,
			currentSwiper:0,
			currentDot:0,
			activeOtherService:0,  //点击其他服务
			activeIndex:0,   //服务部分的tab
			tabCurIndex:0, //社区活动部分的tab

			tabBarList: [
				{
					typeId: 0,
					typeName: '推荐'
				},
				{
					typeId: 1,
					typeName: '美食'
				},
				{
					typeId: 2,
					typeName: '家居'
				},
				{
					typeId: 3,
					typeName: '日化'
				},
				{
					typeId: 4,
					typeName: '户外'
				},
				{
					typeId: 5,
					typeName: '临期'
				},
				// {
				// 	typeId: 6,
				// 	typeName: '分类'
				// }
			],
			topSwiperList:[  //页面顶部 轮播图
			    {
					bannerImage:'https://17lelife-bucket.oss-cn-beijing.aliyuncs.com/WeChat-App-Picture/find_bg.png'
				},
				{
					bannerImage:'https://17lelife-bucket.oss-cn-beijing.aliyuncs.com/WeChat-App-Picture/find_bg.png'
				},
				{
					bannerImage:'https://17lelife-bucket.oss-cn-beijing.aliyuncs.com/WeChat-App-Picture/find_bg.png'
				},			
			],
			// 服务分类
			sortList: [
				{
					sortName: '家政服务',
					key: 1,
				},
				{
					sortName: '洗衣洗鞋',
					key: 2,
				},

				{
					sortName: '上门维修',
					key: 3,
				},
				{
					sortName: '17充电',
					key: 4,
				},
				{
					sortName: '赚积分',
					key: 5,
				},
			],

			// 17拼团
			groupBuyData: [
			// 	{
			// 	image:'https://17lelife-bucket.oss-cn-beijing.aliyuncs.com/WeChat-App-Picture/find/panda.png',
			// 	title: "立达小熊猫 | 悬挂式抽纸1300抽",
			// 	label: ['今日开抢', '每人一份', '好评如潮'],
			// 	joinPeopleNum: 0,
			// 	peopleNum: 100,
			// 	startTime:'2024年12月22日 12:00:00',
			// 	stopTime:'2024年12月24日 9:30:00'
			// },
			// {
			// 	image:'https://17lelife-bucket.oss-cn-beijing.aliyuncs.com/WeChat-App-Picture/find/wudeli.png',
			// 	title: "五得利面粉10斤八星雪花麦芯小麦粉5kg",
			// 	label: ['今日开抢', '数量不限', '卖爆五万','每人一份',],
			// 	joinPeopleNum: 50,
			// 	peopleNum: 100,
			// 	startTime:'2024年12月25日 12:00:00',
			// 	stopTime:'2024年12月29日 12:30:00'
			// },
			// {
			// 	// imgurl: require('../../static/find/maojin.png'),
			// 	image:'https://17lelife-bucket.oss-cn-beijing.aliyuncs.com/WeChat-App-Picture/find/maojin.png',
			// 	title: "三利抗菌加厚毛巾2条A类吸水男女洗脸洗澡家用干发大面巾 棕/灰",
			// 	// label: ['数量不限'],
			// 	joinPeopleNum: 30,
			// 	peopleNum: 100,
			// 	startTime:'2024年12月28日 12:00:00',
			// 	stopTime:'2024年12月29日 12:00:00'
			// }
			],

			tabData: [   //社区活动部分的tab内容
				{
					typeId: 0,
					typeName: '同城活动'
				},
				{
					typeId: 1,
					typeName: '周边商家'
				},
				{
					typeId: 2,
					typeName: '老年大学'
				},
				{
					typeId: 3,
					typeName: '养花养草'
				},
				{
					typeId: 4,
					typeName: '赚积分'
				}],
			actContent: [
				{
					image:'https://17lelife-bucket.oss-cn-beijing.aliyuncs.com/WeChat-App-Picture/actImg1.png',
					title: "社区活动 | 零基础瑜伽体验活动",
					startTime: '10月13日 周六 14:00-16:00',
					location: "水岸华庭·东郡 | 篮球场"
				},
				{
					image:'https://17lelife-bucket.oss-cn-beijing.aliyuncs.com/WeChat-App-Picture/actImg1.png',
					title: "公益活动|心肺复苏 CPR+AED 培训活动",
					startTime: '10月20日 19:00-21:00',
					location: "盐湖区 | 金鑫大酒店"
				}
			],	
			businessData:[
				{
					imgUrl: "https://17lelife-bucket.oss-cn-beijing.aliyuncs.com/WeChat-App-Picture/carBeauty.png",
					merchantName: "车友汽车美容装饰东郡店",
					status:'营业中',
					date: '周一至周日 08:30-22:30',
					address: "水岸华庭·东郡西门 101 商铺",
					door:'西门',
					distance:'580',
					coordinates: {
						latitude: 35.12345,  // 纬度
						longitude: 110.67890  // 经度
					}
				},			
				{
					imgUrl: "https://17lelife-bucket.oss-cn-beijing.aliyuncs.com/WeChat-App-Picture/duoduo.png",
					merchantName: "多多来生鲜水果店",
					status:'营业中',
					date: '周一至周日 08:30-22:30',
					address: "盐湖区 | 金鑫大酒店",
					door:'西门',
					distance:'580',
					coordinates: {
						latitude: 35.12345,  // 纬度
						longitude: 110.67890  // 经度
					}
				},
			],
            swiperCurrent: 0, // 热卖商品手写轮播图
            tabCurrent: 'tabNum1', // 热卖商品手写轮播图
			menuButtonTop:'',   //胶囊距离顶部的距离
			titleTop:'',   //页面最顶部的标题 距离顶部的距离
			currentTime :new Date(), // 获取当前时间并存储
			isAfterCurrentTime: false,
			popupShow:false, //定位授权弹窗
			infoTypes: {
				NICKNAME: '昵称',
				AVATAR: '头像',
				PHONE: '手机号',
				LOCATION: '位置信息',
				CURRENT_LOCATION: '当前位置'
			},
			pageType: PAGE_TYPE.FIND, // 页面类型
			pageNum: 1,
            pageSize: 3,
			startDate: undefined, // 开始时间
			endDate: undefined, // 结束时间
			province: '山西省', // 省
			city: '运城市', // 市
			county: undefined, // 区
			signupRestriction: 0, // 报名限制  0 全员可报 1 仅限业主  2 制定小区
			communityId: undefined, // 小区id
			latitude:'35.035290', // 纬度
			longitude: '110.989768', // 经度
		

			activitiesId: '', // 活动id  分享活动
		}
	},
	computed: {
		isMiddleSelected() {
			return this.activeIndex > 0 && this.activeIndex < this.sortList.length - 1;
		}
	},
	onLoad(data){
		// 新增定位逻辑
		// this.checkLocationAuth();
		// this.loadBusinessData()
		const menuButtonInfo = wx.getMenuButtonBoundingClientRect();
        console.log('胶囊按钮高度：', menuButtonInfo.height,'胶囊按钮top：', menuButtonInfo.top,menuButtonInfo);
        this.menuButtonTop = menuButtonInfo.top
        this.titleTop='margin-top:'+ ( this.menuButtonTop + menuButtonInfo.height/3 ) +'px' 
        console.log(this.titleTop)

		if(data){
			console.log(data,'data')
			if (data && data.activitiesId) {
				console.log('data', data.activitiesId)
				this.activitiesId = data.activitiesId
				if (this.activitiesId) {
					uni.navigateTo({
						url: '/pages/findPage/activityDetail?params=' + encodeURIComponent(JSON.stringify({
							activitiesId: this.activitiesId
						}))
					})
				}
				return false
			}
			const scene = decodeURIComponent(data.scene)
			console.log(scene,'scene')
			const pairs = scene.split('&');
			console.log(pairs,'pairs')
			const sceneObj = {}
            pairs.forEach((pair) => {
                const [key, value] = pair.split('=');
                sceneObj[key] = value;
            });
            console.log(sceneObj,sceneObj.activityId,'sceneObj.activityId')

			if (sceneObj.activityId) {
                this.handleScanCheckIn(sceneObj.activityId);
            }
			
		}

	},
	onReady(){
		this.topStyleWhite()
		console.log(this.currentTime,'pintuanshijian')
		// this.onRefresherMethod()
		this.getFindMethod()
		this.getGroupBuyingPagingQueryMethod()
		this.getActivityList()
		this.getPageMerchantList()
	},
	onShow(){

	},
	

	methods: {
		// onRefresherMethod() {
        //     if (!this.isrefresher) {
        //         this.loadingIsShow = true
        //     }

		// 	Promise.all([this.getActivityList(),this.getGroupBuyingPagingQueryMethod(),this.getFindMethod(),this.getPageMerchantList()]).then(() => {
		// 		console.log('所有api加载完成')
		// 		this.loadingIsShow = false
		// 		this.loadingIsShowPage = false
		// 		// 关闭加载状态 (转动的圈)，需要一点延时才能关闭
		// 		this.time = setTimeout(e => {
		// 			this.isrefresher = false
		// 		}, 200)
		// 	})

        // },

		// 格式化时间  取出startTime中的时间部分  活动列表
		formatTime(timeString) {
			if (!timeString) return '';
			return timeString.split(' ')[1]; // 分割字符串取时间部分
		},
		formattedDate(time){
			return formattedDate(time)
		},
		isCurrentTimeAfterStart(startTimeFromApi) {
			return this.currentTime.getTime() > startTimeFromApi.getTime();
		},
		isCurrentTimeEqualStart(startTimeFromApi) {
			return this.currentTime.getTime() === startTimeFromApi.getTime();
		},
		formatDateForIOS(dateStr) {
			return dateStr.replace(/-/g, '/');
		},
		compareTime(currentTime,strTime) {
			const stopTimeDate = formatTimeToDate(strTime);
			this.isAfterCurrentTime = stopTimeDate > currentTime;
		},
		
		// 新增位置授权检查方法
		async checkLocationAuth() {
			try {
				const res = await uni.getSetting({});
				console.log(res, !res.authSetting['scope.userLocation'], 'checkLocationAuth', uni.authorize({ scope: 'scope.userLocation' }))

				if (!res.authSetting['scope.userLocation']) {
					// 首次请求权限
					const authRes = await uni.authorize({ scope: 'scope.userLocation' });
					if (authRes.errMsg === 'authorize:ok') {
						await this.getCurrentLocation();
					} else {
						// 处理用户拒绝授权的情况
						this.popupShow = true;
					}
				} else {
					let validLocation = checkLocationValid() || getApp().globalData.location || this.$store.state.location
					if (!validLocation) {
						this.getCurrentLocation()
						validLocation = checkLocationValid(); // 重新检查最新位置
						uni.showToast({
							title: '位置信息已更新',
							icon: 'success',
							duration: 1500
						});
					}
					// this.getCurrentLocation(); //不需要每次都获取当前位置
				}
			} catch (error) {
				console.error('权限检查失败:', error);
				uni.showToast({
					title: '权限检查失败，请重试',
					icon: 'none'
				});
			}
		},
		// 在获取商户数据时使用
		async loadBusinessData() {
			try {
				let validLocation = checkLocationValid() || getApp().globalData.location || this.$store.state.location
				if (!validLocation) {
					await this.getCurrentLocation();
					validLocation = checkLocationValid(); // 重新检查最新位置
				}
				// 调用接口时携带位置参数
				// this.fetchBusinessList(validLocation);
				// 3. 携带位置参数请求数据
				if (validLocation) {
					const params = {
						lat: validLocation.latitude,
						lng: validLocation.longitude
					};
					// await this.fetchBusinessList(params);
					this.computedDistance(); // 计算商户距离
				} else {
					uni.showToast({ title: '位置获取失败', icon: 'none' });
				}
			} catch (error) {
				console.error('加载商户数据失败:', error);
				uni.showToast({ title: '数据加载失败', icon: 'none' });
			}
		},

		// 在计算商户距离时使用
		async computedDistance() {
			const location = this.checkLocationValid() || getApp().globalData.location || this.$store.state.location 
			// 2. 无有效位置时重新获取
			if (!location) {
				await this.getCurrentLocation();
				location = checkLocationValid(); // 重新检查最新位置
			}
			if (location && this.businessData) {
				this.businessData.forEach(business => {
					business.distance = calculateDistance(location, business.coordinates)
				});
			}
		},
		// 新增授权按钮处理
		handleAuthLocation() {
			uni.authorize({
				scope: 'scope.userLocation',
				success: () => {
					this.getCurrentLocation();
					// this.$refs.locationPopup.close();
					this.popupShow = false
				},
				fail: () => {
					uni.showModal({
						title: '提示',
						content: '需要位置权限才能获取周边服务',
						confirmText: '去设置',
						success: (res) => {
							if (res.confirm) {
								uni.openSetting();
							}
						}
					});
				}
			});
		},

		// 新增获取位置方法
		async getCurrentLocation() {
			uni.getLocation({
				type: 'wgs84',
				success: (res) => {
					console.log('位置获取成功---', res);
					const locationData = {
						...res,
						timestamp: Date.now(),
						source: '用户主动授权'
					};
					// 这里可以存储到vuex或全局变量
					// uni.$emit('locationUpdate', res);
					// this.$store.commit('SET_LOCATION', res);
					// 方式2：存储到全局变量（app.js中需初始化globalData）
					getApp().globalData.location = locationData;

					// 方式3：存储到本地缓存（带有效期）
					uni.setStorage({
						key: 'CURRENT_LOCATION',
						data: locationData,
						success: () => {
							console.log('位置存储成功');
							// 记录信息收集
							this.recordCollection({
								type: this.infoTypes.CURRENT_LOCATION,
								time: new Date().toISOString(),
								source: '位置服务授权'
							});
						}
					});

				},
				fail: (err) => {
					console.error('定位失败:', err);
					// 定位失败，判断错误原因并提示用户
					if (err.errMsg.includes('system permission denied')) {
						wx.showModal({
							title: '定位服务未开启',
							content: '1.打开系统偏好设置 -> 安全性与隐私 -> 隐私 -> 定位服务 -> 启用定位服务;\n2.允许"微信"使用定位服务;',
							confirmText: '去设置',
							cancelText: '取消',
							success: function (res) {
								if (res.confirm) {
									// 跳转到系统设置页面
									wx.openSetting({
										success: function () {
											console.log('已打开设置页面');
										}
									});
								}
							}
						})
					} else if (err.errMsg.includes('auth')) {
						this.popupShow = true; // 显示授权弹窗
						uni.showToast({
							title: '需要位置权限才能继续',
							icon: 'none'
						});
					} else {
						// 尝试使用最后已知位置
						const lastLocation = uni.getStorageSync('CURRENT_LOCATION');
						if (lastLocation && Date.now() - lastLocation.timestamp < 3600000) {
							return lastLocation;
						}
						throw new Error('定位服务不可用');
					}
				}
			});
		},

		// 新增关闭弹窗方法
		closePopup() {
			// this.$refs.locationPopup.close();
			this.popupShow = false
			uni.showToast({
				title: '可在设置中重新授权',
				icon: 'none'
			});
		},

		// // 新增位置校验方法
		// checkLocationValid() {
		// 	const location = uni.getStorageSync('CURRENT_LOCATION');
		// 	if (!location) return false;

		// 	// 校验位置有效期（15分钟）
		// 	const isRecent = Date.now() - location.timestamp < 900000;
		// 	// 校验坐标范围（山西省大致范围）
		// 	const validRange =
		// 		location.latitude > 34.5 && location.latitude < 40.5 &&
		// 		location.longitude > 110.2 && location.longitude < 114.5;

		// 	return isRecent && validRange;
		// },

        topStyleWhite () {
            // 手机顶部
            // eslint-disable-next-line no-undef
            wx.setNavigationBarColor({
                frontColor: '#ffffff',
                backgroundColor: 'rgba(255, 255, 255, 0)'
            })
        },
		handleScroll(e) {
			console.log('顶部滚动距离', e.detail.scrollTop,this.scrolling, e.detail.scrollTop > 0)
			const scrollTop = e.detail.scrollTop;
			const threshold = 25; // 设置临界阈值
			
			if (scrollTop > 5 && !this.scrolling) {
				topStyleBlack()
				this.scrolling = true
				this.scrollMT = 'margin-top: 212px'
			} else if (scrollTop<= 5 && this.scrolling) {
				this.scrolling = false
				this.scrollMT = ''
				this.topStyleWhite()
			}
			this.bgOpacity = `background: rgba(255, 255, 255, ${e.detail.scrollTop / 100})`
			console.log(this.bgOpacity)
		},

		// 轮播图事件
		changeSwiper(e){
			// console.log('wwwwww',e.detail.current)
			this.currentDot=e.detail.current   //指示点随着轮播图动

		},
		// 点击轮播图上指示点
		swiperDot(index){
			// console.log(index,'index currentDot')
			this.currentSwiper=index   // 轮播图随着指示点动
		},

		
		changeNav(index) {
			console.log(index,'点击的第'+ index)          
		},

		clearStorage() {
			uni.showToast({
				title: '清除成功',
				icon: 'success',
				duration: 2000, // 提示的延迟时间，单位毫秒，默认：1500
				mask: false, // 是否显示透明蒙层，防止触摸穿透，默认：false
				// image:'./image.png',//自定义图标的本地路径
			})
		},
		changeTabs(index,e) {
			this.tabCurIndex = index
			console.log(e, '090909')

		},
		// 组件
		onChangeNav() {
			console.log("11111")
		},
		onTabClick(val, e) {
			this.activeOtherService=val
			console.log(val, '发现页服务')
			const params={}
			if(val===1){  //洗衣洗护
				uni.navigateTo({
					url:'/pages/service/laundryCare?params='+
					encodeURIComponent(JSON.stringify(params)),
					success: () => {
						// 如果是来自赚积分页面的任务，触发计时开始
						if (getApp().globalData.fromEarnPoints && getApp().globalData.taskType == 'life_service') {
							uni.$emit('servicePageShown',{
								taskId: getApp().globalData.currentTask.id,
								duration: getApp().globalData.currentTask.taskDuration
							});
						}
					}
				})
			}else if(val===2){
				uni.navigateTo({
					url:'/pages/service/installService?params='+
					encodeURIComponent(JSON.stringify(params)),
					success: () => {
						// 如果是来自赚积分页面的任务，触发计时开始
						if (getApp().globalData.fromEarnPoints && getApp().globalData.taskType == 'life_service') {
							uni.$emit('servicePageShown');
						}
					}
				})
			}else if(val===4){
				uni.navigateTo({
					url:'/pages/integral/earnPoints'
				})
			}
		},

		// 热卖轮播
        lookInfo(index,e,item){
			this.swiperCurrent = index
            // this.tabCurrent = 'tabNum' + index
            console.log(index, item, '组件', this.tabCurrent, 'tabCurrent++', this.swiperCurrent)
            // this.$emit('gradeSelect', index, item)
		},
		scrollPage (e) {
            this.bgOpacity = `opacity:${1 - e.detail.scrollTop / this.navHeight}`
        },
		scrolltolower () {
            // if (this.totalPage <= this.listData.length) {
            //     this.isLoadAll = true
            //     this.loadingText = '没有更多数据啦~'
            // } else {
            //     // this.studentInfoTiWenParams.pageNum++
            //     this.pageNum++
            //     this.isLoadAll = true
            //     this.loadingText = '加载中...'
            //     this.getStudentDetailsMethod(true)
            // }
        },

		// 跳转服务明细页面
		toServiceDetail(val){
			switch (val) {
				case 1:  //钟点服务
					uni.navigateTo({ url: '/pages/service/zhongdian' })
					break;
				case 2:  //全屋清扫
				uni.navigateTo({ url: '/pages/service/wholeHouseClean' })
					break;
				case 3: // 厨房保洁
				uni.navigateTo({ url: '/pages/service/kitchenCleanService' })
					break;
				case 4:  //家电清洗
				uni.navigateTo({ url: '/pages/service/applianceClean' })
					break;
				case 5:  //管道疏通
				uni.navigateTo({url: '/pages/service/DCService' })
					break;
			}
		},

		//17拼团
		toMorePinTuan(){
			const params = {}
			uni.navigateTo({
				url: '/pages/findPage/pinTuan?params='+
				encodeURIComponent(JSON.stringify(params))
			})
		},


		// 跳转活动详情
		toActivityDetail(i) {
			const params = {
				pageType: PAGE_TYPE.FIND,
				pageSign: this.pageSign,
				activitiesId: i.activities.id,
				signUpActId: undefined,  //活动报名id
				activityStatus: i.status ,
				fromEarnPoints: this.fromEarnPoints,
				isSignedUp:i.isSignedUp || false ,
			}
			uni.navigateTo({
				url: '/pages/findPage/activityDetail?params=' +
					encodeURIComponent(JSON.stringify(params))
			})

		},
		// 同城活动
		toMoreActivities(){
			const params = {
				pageType:PAGE_TYPE.FIND,
				// pageBiaoshi:'find'
			}
			uni.navigateTo({
				url: '/pages/findPage/activitiesList?params='+
				encodeURIComponent(JSON.stringify(params))
			})
		},
		// 去抢购
		goBuy(item){
			const params = {
                biaozhi:'find',
			    productId:item.productId,
                show:true,
                groupBuyId:item.id
            }
			uni.navigateTo({
                url:
              '/pages/shangcheng/goodsDetail?params=' +
              encodeURIComponent(JSON.stringify(params))
            })
		},

		// // 拼团详情 去抢购是一个页面
		// toGroupBuyingProduct(productId){
		// 	const params = {}
		// 	params.biaozhi='find'
		// 	params.id=productId
		// 	params.show=false
		// 	uni.navigateTo({
        //         url:
        //       '/pages/shangcheng/goodsDetail?params=' +
        //       encodeURIComponent(JSON.stringify(params))
        //     })
		// },

		toMerchantInfo(item){
			uni.navigateTo({
				url: '/pages/merchant/merchantInfo?params='+
				encodeURIComponent(JSON.stringify({merchantId:item.id}))
			})
		},

		// 活动状态修改
		formatStatus(status) {
			const mineStatusMap = {
				0: '已报名',
				1: '已参加',
				2: '已取消'
			};

			const normalStatusMap = {
				0: '未发布',
				1: '报名中',
				2: '报名已满',
				3: '已结束',
				4: '已取消'
			};
			return this.pageSign == 'mine'
				? mineStatusMap[status] || ''
				: normalStatusMap[status] || '';
		},

		getGroupBuyStatus(startTimeStr, stopTimeStr) {
			const currentTime = new Date(); // 当前时间
			const startTime = new Date(this.formatDateForIOS(startTimeStr)); // 转换为Date对象
			const stopTime = new Date(this.formatDateForIOS(stopTimeStr)); // 转换为Date对象

			if (currentTime < startTime) {
				return '未开始';
			} else if (currentTime > stopTime) {
				return '已结束';
			} else {
				return '进行中';
			}
		},
		/**
		 * 接口
		 */
		// getFindList
		getFindMethod(){
			return new Promise((resolve, reject) => {
                getFindApi ({}).then((res) => {
                    // console.log(res)
					if (res.code === 200) {
						console.log(res.data, res.data[0].mpBannerManagement, 'res发现')
						this.topSwiperList = res.data[0].mpBannerManagement
						if( res.data[0] && res.data[0].mpActivities && res.data[0].mpActivities.length>0){
							res.data[0].mpActivities.forEach(ele => {
								ele.startTime = formattedDate(ele.startTime)
							});
							this.actContent = res.data[0].mpActivities
						}
						console.log(this.actContent, 'actContent')
						const time = formattedDate("2024-12-02T07:53:57.000+0000")
						console.log(time)
						// debugger
						// if( res.data[0] && res.data[0].ebStoreGroupBuyingProductResponseDTO && res.data[0].ebStoreGroupBuyingProductResponseDTO.length>0){
						// 	res.data[0].ebStoreGroupBuyingProductResponseDTO.forEach(item => {
						// 		const labelArray = item.label.split("，");
						// 		item.label = labelArray
						// 		item.joinPeopleNum = Number(item.joinPeopleNum)
						// 		item.peopleNum = Number(item.peopleNum)

						// 		const iosCompatibleStartDateStr = this.formatDateForIOS(item.startTime);
						// 		const iosCompatibleStopDateStr = this.formatDateForIOS(item.stopTime);

						// 		item.startTime = new Date(iosCompatibleStartDateStr)
						// 		item.stopTime = new Date(iosCompatibleStopDateStr)

						// 		console.log(this.currentTime > item.startTime, this.currentTime > item.stopTime, typeof (item.joinPeopleNum), 'pppppoooooo')
						// 	})
						// 	console.log(res.data[0].ebStoreGroupBuyingProductResponseDTO, 'iiii')
						// 	this.groupBuyData = res.data[0].ebStoreGroupBuyingProductResponseDTO
						// }


						resolve(res)
					} else {
						reject(res)
					}
                })
            })
		},

		// 扫码签到
		async handleScanCheckIn(activityId) {
			console.log(activityId, 'activityId');
			try {
				console.log(activityId, 'activityId');
				uni.showLoading({ title: '签到中...' });
				const res = await scanActivityApi(activityId);
				console.log(res, '签到结果');
				if (res.code === 200) {
					const params = {
						signUpActId: res.data.id,
						activityId:activityId,
						pageSign: 'scan',
						actStatus: 1 ,// 1表示已签到
						// data:res.data,
					};
					uni.showLoading({ title: '签到成功，跳转中...' }); // 二次提示
					await new Promise(resolve => setTimeout(resolve, 500)); // 保证至少显示500ms
					uni.redirectTo({
						url: `/pages/findPage/registResult?params=${encodeURIComponent(JSON.stringify(params))}`
					});
				} else {
					uni.showToast({ title: res.message || '签到失败', icon: 'none' });
				}
			} catch (error) {
				console.error('签到失败:', error);
				uni.showToast({ title: '网络异常，请重试', icon: 'none' });
			} finally {
				uni.hideLoading();
			}
		},
		calculateDistance(currentPos, targetPos) {
			// 方法1：Haversine公式（球面距离，精度较高）
			const toRad = (degree) => degree * Math.PI / 180;
			const R = 6371; // 地球半径（公里）

			const dLat = toRad(targetPos.latitude - currentPos.latitude);
			const dLon = toRad(targetPos.longitude - currentPos.longitude);

			const a =
				Math.sin(dLat / 2) * Math.sin(dLat / 2) +
				Math.cos(toRad(currentPos.latitude)) *
				Math.cos(toRad(targetPos.latitude)) *
				Math.sin(dLon / 2) * Math.sin(dLon / 2);

			const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
			const distance = R * c * 1000; // 转换为米

			return Math.round(distance);

			// 方法2：简化版平面三角计算（适合小范围）
			/*
			const dx = 111300 * (targetPos.longitude - currentPos.longitude);
			const dy = 111300 * (targetPos.latitude - currentPos.latitude);
			return Math.round(Math.sqrt(dx*dx + dy*dy));
			*/
		},
		// 商户的地址计算
		formatDistance(distanceInMeters) {
			// debugger
			if (distanceInMeters < 1000) {
				return `${Math.round(distanceInMeters)}米`;
			} else {
				const km = distanceInMeters / 1000;
				console.log(km, 'km',km.toFixed(1))
				return `${km.toFixed(1)}千米`;
			}
		},
		// 接口 
        getGroupBuyingPagingQueryMethod() {
            // if (this.loading || this.finished) return;
            // this.loading = true;
			this.pageNum = 1
			this.groupBuyData = []
            return new Promise((resolve, reject) => {

                const params = {
                    pageNo:this.pageNum,
                    pageSize:this.pageSize,
                }
                getGroupBuyingPagingQueryApi(params).then((res) => {
                    console.log(res.data)
                    if (res.code === 200) {
                        // this.total = res.data.total;                   
                        this.groupBuyData = this.pageNum === 1
                            ? res.data.list
                            : [...this.groupBuyData, ...res.data.list];
                        // this.finished = this.groupBuyData.length >= this.total;
                        // this.pageNum++;
                        // console.log(this.groupBuyData, 'this.groupBuyData')

                        this.groupBuyData.forEach(item => {
                            // item.labelList =item.label.split(',')
                            console.log(item.labelList,'item.labelList')
                            item.progress = (Number(item.groupBuyingProductOrderCount) / Number(item.groupBuyingProductCount)) * 100;
							// item.startTime = this.formatDateForIOS(item.startTime)
							// item.stopTime = this.formatDateForIOS(item.stopTime)
							console.log(item.startTime, item.stopTime, 'item.startTime')
							item.groupBuyStatus = this.getGroupBuyStatus(item.startTime, item.stopTime);
							console.log(item.groupBuyStatus, 'item.groupBuyStatus')
                        });
                        resolve(res)
                    } else {
                        reject(res)
                    }
                })
            })
        },

		// 活动列表
		getActivityList() {
			this.pageNum = 1
			this.actContent = []

			const apiParams = {
				...(this.startDate && { startTime: this.startDate }),
				...(this.endDate && { endTime: this.endDate }),
				province: this.province,
				city: this.city,
				signupRestriction: this.signupRestriction, //活动报名限制
				...(this.communityId && {communityId: this.communityId}), // 小区id
				pageNum: this.pageNum,
				pageSize: 3,
			}
			console.log(apiParams,'apiParams')
			return new Promise((resolve, reject) => {
				getActivityListApi( apiParams ).then((res) => {
				console.log(res.data)
					if (res.code === 200) {
						// this.total = res.data.total;
						// 修改数据合并方式
						this.actContent = this.pageNum === 1
						? res.data.list
						: [...this.actContent, ...res.data.list];

						this.actContent.forEach(item => {
							item.image = 'https://17lelife-bucket.oss-cn-beijing.aliyuncs.com/WeChat-App-Picture/actImg1.png'
							item.statusText = this.formatStatus(item.activities.status)
							item.times = this.formatTime(item.activities.startTime)
						})
						// this.finished = this.actContent.length >= this.total;
						// this.pageNum++;
						// console.log(this.actContent, 'this.orderList')
						// this.isOrder = this.actContent.length > 0

						resolve(res)
					} else {
						reject(res)
					}
				}).finally(() => {
				this.loading = false;
				})
			})
		},

		// 商户详情 
		getPageMerchantList() {
			this.pageNum = 1
			this.businessData = []
			
			const params = {
				// communityId: this.communityId, //社区id
				pageNum: this.pageNum,
				pageSize: this.pageSize,
				latitude: Number(this.latitude),
				longitude:Number(this.longitude),
			}
			return new Promise((resolve, reject) => {
				getPageMerchantListApi(params).then((res) => {
					if (res.code === 200) {
						// this.total = res.data.total;
						// 修改数据合并方式
						this.businessData = this.pageNum === 1
						? res.data.list
						: [...this.businessData, ...res.data.list];

						this.businessData.forEach(item => {
							item.distance =this.formatDistance(Number(item.distance))
							console.log(item.distance,'item.distance')
						})
						resolve(res)
					} else {
						reject(res)
					}
				}).finally(() => {
					this.loading = false;
				})
			})
		}

	}
}
</script>

<style lang="scss" scoped>

.content {
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
	// height: 100vh;
	height: calc(100vh - 100rpx);
	overflow-y: auto;
	// overflow: hidden;    //有滚动
	z-index: -2;
	background-size: 100%;
	background-color: #F9F9F9;
}

.main {
	position: relative;
	// margin-bottom:36px;
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
	background-color: #F9F9F9;
	height: 100vh;

	.fixed_top {
		position: fixed;
		width: 100%;
		z-index: 999;
	}
	.top_display{
		display: none;
	}
}
.content-top {
	display: flex;
	transition: all 0.3s ease;
    will-change: opacity, margin-top; /* 启用硬件加速 */
}

// hos life
.top_title{
	display: flex;
	align-items: center;
	position: relative;
	margin-top: 60px;
	padding-left: 21px;
	font-weight: bolder;
	font-size: 32rpx;
	text-align: left;
	color: #111111;
	line-height: 32rpx;
	z-index: 3;
	padding-bottom: 18px;
	transition: all 0.3s ease;
    will-change: opacity, margin-top; /* 启用硬件加速 */
}




// 轮播图部分
.sur_box_bg {
	position: absolute;
	top: 0px;
	// z-index: -1;
	// height: 461px;
	width: 100%;
	height: 280px;


	.top_swiper {
		display: block;
		width: 100%;
		// height: 461px;
		height: 320px;
		// box-shadow:0px 20px 15px rgb(248, 228, 172);

	}
	// .swiper_item{
	// 	box-shadow:0px 20px 15px rgb(248, 228, 172);
	// }

	img {
		width: 100%;
		// height: 461px;
		height: 320px;

	}

	// 轮播图的三个点
	.swiper-dots-box {
		position: absolute;
		top: 198px;
		width: 100%;
		height: 3px;
		display: flex;
		align-items: center;
		justify-content: center;
		text-align: center;
	}

	// 未选中
	.swiper-dots-box span {
		float: left;
		width: 18px;
		height: 3px;
		border-radius: 3px;
		margin-left: 3px;
		cursor: pointer;
		// transition: all 0.5s ease-out;
		background: transparent;
		// border: 1px solid #FFFFFF;
		background: rgba(153, 153, 153, 0.4);
	}

	// 选中
	.swiper-dots-box .active {
		background: #ffffff;
		width: 18px;
		height: 3px;
		border: none;
	}
}


.scroll-content {
    flex: 1;
    height: 1px;
}
.scrollMain_box{
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
	z-index: -1;
	// overflow: hidden;
	// overflow:auto;
	
}


// 服务部分
.service_wrap_box {
	z-index: 1;
	//不可以加颜色
	border-radius: 12px;
	box-sizing: border-box;
	margin-top: 211px;
	margin-left: 12px;
	margin-right: 12px;

	// 服务部分上部分类tab
	.tabs_box {
		// height: 54px;
		// line-height: 54px;
		padding-top: 3px;
	}

	.top-tabs {
		display: flex;
		border-radius: 12px 12px 0 0;
		background: #fcf4e1;


		.box {
			// flex: 1;
			width: 24%;
			height: 100rpx;
			line-height:100rpx;
			// font-weight: 400;
			font-size: 28rpx;
			text-align: left;
			color: #333333;
		}
	}

	.top-tab-item {

		height: 100rpx;
		margin: 0 auto;
		cursor: pointer;
		position: relative;
		text-align: center;
		line-height: 100rpx;
	}

	.top-tab-item.active {
		font-weight: bolder;
		font-size: 32rpx;
		// text-align: center;
		color: #111111;
		position: relative;
		// 以下两个针对第一个按钮设置   背景图top:-4px
		padding-left: 20rpx;
		line-height: 106rpx;

	}

	.actL {
		position: absolute;
		top: -6rpx;
		text-align: left;
		background: url("https://17lelife-bucket.oss-cn-beijing.aliyuncs.com/WeChat-App-Picture/actL_img.png?") no-repeat;
		background-size: 100%;
		height: 106rpx;
		width: 164rpx;
		// height: 48px;
		// width: 82px;

	}


	.serviceContentBox {
		background: #fcf4e1;
		border-radius: 0 0 6px 6px;
	}

	// 服务内容 边框 角
	.service_border_radiusL {
		border-radius: 0 12px 6px 6px;
	}

	.service_border_radiusR {
		border-radius: 12px 0px 6px 6px;
	}

	.service_border_radius {
		border-radius: 6px;
	}

	// 服务部分的内容  图标+文字
	.serviceContent-wrap {

		padding-top: 42rpx; //距离点击后的 盒子上16px
		// padding: 0 10px; //内容左右10px
		padding-bottom: 50rpx;

		background: #ffffff;
		display: flex;
		justify-content: space-between;


		.serviceContent {
			text-align: center;
			flex: 1;
			width: 20%;

			.service_icon {
				width: 68rpx;
				height: 68rpx;
				line-height: 68rpx;

				img {
					width: 68rpx;
					height: 68rpx;
				}
			}

			.service_name {
				// font-weight: bold;
				height: 24rpx;
				font-size: 24rpx;
				text-align: center;
				color: #111111;
				line-height: 24rpx;
				margin-top: 20rpx;
			}
		}
	}

	.wrap-empty {
		min-height: 60px;
		line-height: 60px;
		font-size: 11px;
		text-align: center;
		color: #333333;
	}
}

// 17拼团活动
.pinTuan {
	border-radius:6px;
	background: #ffffff;
	margin: 9px 12px 0px 12px;
	// 内容部分最后有个bottom10px 这里减掉   后期改
	padding: 15px 12px 4px 12px;
	// padding: 15px 10px 4px 10px;

	.pinTuan_title {
		// vertical-align: middle;
		height: 16px;
		line-height: 16px;
		display: flex;
		align-items: center;
		justify-content: space-between;

		.act_title {
			display: flex; //文字 图片
			// float: left;

			.act_title_text {
				font-weight: 900;
				height: 32rpx;
				line-height: 32rpx;
				font-size: 32rpx;
				text-align: left;
				color: #111111;
			}

			.act_title_img {
				width: 32rpx;
				height: 32rpx;
				margin-left: 6rpx;
			}
		}

		.act_more {
			// float: right;
			line-height: 20rpx;
			vertical-align: middle;
			// font-weight: 400;
			height: 20rpx;
			font-size: 20rpx;
			text-align: right;
			color: #666666;


			.act_t {
				color: #666666;
				// font-weight: 400;
				font-size: 20rpx;
			}

			.act_Im {
				vertical-align: -2rpx;
			}
		}
	}

	.pinTuan_content {
		margin-top: 30rpx;
	}

	.bottom_left {
		width: calc(100% - 102rpx);
	}

	.goBuy_icon {
		margin-top: 2%;
		height: 38rpx;
		width: 70rpx;
		line-height: 38rpx;
		border-radius: 2px 2px 2px 2px;
		background: url("https://17lelife-bucket.oss-cn-beijing.aliyuncs.com/WeChat-App-Picture/find/goBuy.png") no-repeat;
		background-size: 100%;
		// font-weight: 700;
		font-size: 16rpx;
		text-align: center;
		color: #FFFFFF;
		// position: absolute;
		// right: 0;
		// bottom: 15px;
	}
}

// 拼团内的滚动条 去掉自带的文字提示  
::v-deep .van-progress__pivot {
	display: none;
}

// 拼团活动 社区活动共用部分
// 社区商家活动部分 盒子样式
.box_content {
	// margin-bottom: 12px;
	.content_img {
		margin-right: 20rpx;
		// width: 112rpx;
		// height: 112rpx;
		// line-height: 112rpx;
		width: 20%;
		display: flex;
		flex-direction: column;
		justify-content: center;
		img{
			// width: 112rpx;
			// height: 112rpx;
			width: 100%;
			height: auto;
		}
	}

	.content_text {
		width: calc(80% - 20rpx);
		display: flex;
		justify-content: center;
		flex-direction: column;

		.content_text_title {
			color: #333333;
			font-size: 28rpx;
			text-align: left;
			line-height: 36rpx;
			// margin-top: 2px;
			max-width: 100%;
		}

		.text_title{
			// 超过两行  文字用省略号
			// display: -webkit-box;
			// -webkit-line-clamp: 2;
			// -webkit-box-orient: vertical;
			// overflow: hidden;
			// text-overflow: ellipsis;
			// white-space: normal;

			// 超过一行  文字用省略号
			white-space: nowrap;
			/* 防止文本换行 */
			overflow: hidden;
			/* 超出部分隐藏 */
			text-overflow: ellipsis;
			/* 显示省略号 */
			// white-space: normal;
		}

		 .content_text_tips_box {
            display: flex;
            overflow-x: auto;
            white-space: nowrap;
            -webkit-overflow-scrolling: touch;
            padding-bottom: 5px; /* 给滚动条留空间 */
        }

        .content_text_tips {
            flex-shrink: 0;
            margin-right: 10rpx;
        }

        .tips_span {
            display: inline-block;
            padding: 0 10rpx;
            border-radius: 14rpx;
            background: #cecece;
            font-size: 20rpx;
            color: #FFFFFF;
            white-space: nowrap;
        }

		// .content_text_tips_box{
		// 	// display: flex;
		// 	// align-items: center;
		// 	// overflow: hidden;
		// 	// white-space: nowrap;
		// 	display: -webkit-box;
		// 	-webkit-line-clamp: 1;
		// 	-webkit-box-orient: vertical;
		// 	overflow: hidden;
		// 	white-space: normal;
		// }

		// .content_text_tips {
		// 	display: inline-block;
		// 	margin-bottom: 12rpx;
		// 	box-sizing: border-box;
		// 	margin-right: 10rpx;
		// 	border-radius: 14rpx;
		// 	background: #cecece;
		// 	font-size: 20rpx;
		// 	line-height: 20rpx;
		// 	text-align: center;
		// 	color: #FFFFFF;
		// 	white-space: nowrap; /* 设置文本不换行，确保内容完整显示在一行内 */
		// 	padding: 4rpx 12rpx;
		// 	text-overflow: ellipsis;
		// 	overflow: hidden;
		// }
		// .content_text_tips:last-child{
		// 	margin-right: 0px;
		// }
		// .tips_span {
		// 	box-sizing: border-box;
		// 	padding: 0rpx 8rpx;
		// 	border-radius: 14rpx;
		// 	background: #cecece;
		// 	font-size: 20rpx;
		// 	// line-height: 20rpx;
		// 	text-align: center;
		// 	color: #FFFFFF;
		// }
		// .tips_span:last-child{
		// 	margin-right: 0px;
		// }

		// 同城活动 部分的详情

		// 超过一行省略
		.sj_title{
			max-width: 100%;
            white-space: nowrap;
            /* 防止文本换行 */
            overflow: hidden;
            /* 超出部分隐藏 */
            text-overflow: ellipsis;
            /* 显示省略号 */
		}
		.content_text_subtitle {
			// font-weight: 400;
			font-size: 20rpx;
			text-align: left;
			color: #111111;
			// height: 20rpx;
			// line-height: 20rpx;
			

			max-width: 100%;
            white-space: nowrap;
            /* 防止文本换行 */
            overflow: hidden;
            /* 超出部分隐藏 */
            text-overflow: ellipsis;
            /* 显示省略号 */
		}

		// 同城活动下的地址
		.content_text_address {
			font-size: 20rpx;
			text-align: left;
			color: #999999;
			// letter-spacing: 2px;
			// height: 20rpx;
			// line-height: 20rpx;
			max-width: 100%;
            white-space: nowrap; /* 防止文本换行 */
            overflow: hidden;  /* 超出部分隐藏 */
            text-overflow: ellipsis; /* 显示省略号 */
		}

		.content_sj_address {
			height: 24rpx;
			line-height: 24rpx;
			font-size: 20rpx;
			text-align: left;
			display: flex;
			color: #888888;
		}

		.content_text_bottom {
			width: 100%;
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding-top: 12rpx;
		}

		.content_text_progress {
			position: relative;
			// margin-top: 12rpx;

			.progress_span {
				position: absolute;
				// font-weight: 400;
				font-size: 5px;
				line-height: 5px;
				text-align: left;
				color: #ffffff;
				top: 2px;
				left: 20rpx;
			}

			// 伪类   进度条里的图标
			::v-deep .van-progress__portion::before {
				content: ' ';
				width: 8px;
				height: 8px;
				position: absolute;
				top: 1px;
				right: 0;
				// left: 0;
				background: url('https://17lelife-bucket.oss-cn-beijing.aliyuncs.com/WeChat-App-Picture/find/progress_logo.png');
				background-size: 100% 100%;
				background-repeat: no-repeat;
				z-index: 99;
			}
			.hide-before::before{
				display: none!important;
			}
			::v-deep .hide-before .van-progress__portion::before{
				display: none!important;
			}
		}

	}
}

// 多次用到display
.act_display {
	display: flex;
}



// 社区活动
.activity {
	border-radius: 6px;
	background: #ffffff;
	// margin: 24rpx;
	margin: 24rpx 24rpx 0rpx 24rpx;
	padding: 30rpx 24rpx 0rpx 24rpx;

	.activity_title {
		height: 28rpx;
		line-height: 28rpx;
	}

	.act_title {
		float: left;
		font-weight: 900;
		height: 32rpx;
		line-height: 32rpx;
		font-size: 32rpx;
		text-align: left;
		color: #111111;
	}


	.act_more {
		float: right;
		line-height: 20rpx;
		vertical-align: middle;
		height: 20rpx;
		font-size: 20rpx;
		text-align: right;
		color: #666666;


		.act_t {
			color: #666666;
			font-size: 20rpx;
		}

		.act_Im {
			vertical-align: -2rpx;
		}
	}



	// 手写页面最下tab
	.act_tabs {
		margin-top: 28rpx;
		margin-bottom: 28rpx;
		height: 28rpx;
		line-height: 28rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.white {
		.tabbar-item {
			flex: auto;
			z-index: 1;
			text-align: center;
			font-size: 24rpx;
			// font-weight: bold;
			color: #666666;

			&.active {
				// font-family: 'PingFang SC';
				font-style: normal;
				font-weight: 900;
				font-size: 28rpx;
				color: #333333;
			}
		}
	}

	
	// 同城活动   右侧文字部分
	.sj_text{
		width: calc(80% - 20rpx);
		display: flex;
		justify-content: space-between;
		flex-direction: column;
		white-space: nowrap;
		/* 防止文本换行 */
		overflow: hidden;
		/* 超出部分隐藏 */
		text-overflow: ellipsis;
		/* 显示省略号 */
	}

	.activity_content{
		margin-top: 30rpx;
	}

	.sj_bg {
		border-radius: 6rpx;
		background: #ffffff;
		// padding: 24rpx 20rpx 24rpx 24rpx;
		margin-bottom: 24rpx;
	}
	.sj_bg :last-child{
		margin-bottom: 0px;
	}
}


::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
    color: transparent;
}

// 商家盒子
.business {
	margin:24rpx;
	.business_bg {
		border-radius: 6px;
		background: #ffffff;
		padding: 24rpx 20rpx 24rpx 24rpx;
		margin-bottom: 20rpx;
		display: flex;

		.business_box_content_left,.content_img_sj {
			text-align: left;
			width: 20%;
			margin-right: 20rpx;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;

			img {
				width: 100%;
				height: auto;
			}
		}


	.business_box_content_right {
		display: flex;
		justify-content: space-between;
		width: calc(80% - 20rpx);
	}
	.business_box_content_right_L {
		width: calc(100% - 164rpx);
		padding-top: 5rpx;
		text-align: left;
		display: flex;
		flex-direction: column;
		justify-content: space-between;

		.content_text_title {
			color: #222222;
			font-size: 28rpx;
			text-align: left;
			line-height: 28rpx;
		}

		.content_text_date {
			// font-weight: 400;
			height: 20rpx;
			font-size: 20rpx;
			text-align: left;
			color: #111111;
			line-height: 20rpx;
			margin-top: 18rpx;
		}

		.content_sj_date {
			font-size: 20rpx;
			height: 20rpx;
			line-height: 20rpx;
			margin-top: 18rpx;
			text-align: left;
			color: #888888;
		}

		.content_text_address {
			height: 20rpx;
			font-size: 20rpx;
			text-align: left;
			color: #888888;
			line-height: 20rpx;
		}

		.content_sj_address {
			height: 24rpx;
			line-height: 24rpx;
			font-size: 20rpx;
			text-align: left;
			display: flex;
			color: #888888;
			max-width: 100%;
            white-space: nowrap;
            /* 防止文本换行 */
            overflow: hidden;
            /* 超出部分隐藏 */
            text-overflow: ellipsis;
		}
	}

	// 商家活动box 右侧电话地址
	.business_box_content_right_R {
		text-align: right;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		width: 164rpx;

		.phone_icon {
			height: 32rpx;
			line-height: 32rpx;
			margin-bottom: 22rpx;

			img {
				width: 32rpx;
				height: 32rpx;
			}
		}

		.door {
			font-weight: bolder;
			height: 26rpx;
			line-height: 26rpx;
			font-size: 26rpx;
			color: #222222;
		}

		.distance {
			font-size: 20rpx;
			line-height: 20rpx;
			color: #333333;
			text-align: right;
		}
	}
	.business_address{
		max-width: 100%;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	}


	.display_space_b {
		justify-content: space-between;
	}

	// span样式  未生效
	.sj_status {
		color: #111111;
		margin-right: 10rpx;
	}

	.sj_date {
		// font-size: 9px;
		// line-height: 10px;
		color: #888888;
	}

	
}


// 为您推荐
.forYou{

	padding-left: 24rpx;
	padding-right: 24rpx;

}

// 底部广告图片位置
.guanggao{
	width: 100%;
	margin-top: 70rpx;
	height:236rpx;
	img{
		width: 100%;
	}
}

// logo
.logo_img {
	text-align: center;
	padding-bottom: 50px;
}

/* 新增弹窗样式 */
.auth-popup {
    background: #fff;
    padding: 40rpx;
    border-radius: 24rpx 24rpx 0 0;
    text-align: center;
}

.popup-icon {
    width: 120rpx;
    height: 120rpx;
    display: block;
    margin: 0 auto 20rpx;
}

.popup-title {
    font-size: 36rpx;
    font-weight: bold;
    display: block;
    margin-bottom: 16rpx;
}

.popup-desc {
    color: #999;
    font-size: 28rpx;
    display: block;
    margin-bottom: 40rpx;
}

.auth-btn {
    background: #07c160;
    color: #fff;
    border-radius: 48rpx;
    margin: 0 30rpx 20rpx;
}

.close-btn {
    color: #999;
    font-size: 28rpx;
    display: block;
    padding: 20rpx;
}

// margin 
.pl8{
	padding-left: 16rpx;
}
.pr8{
	padding-right:16rpx;
}
.l10{
	margin-left:20rpx;
}
.r2 {
	margin-right: 4rpx;
}
.r5 {
	margin-right: 10rpx;
}

.r10 {
	margin-right: 20rpx;
}

.t1 {
	margin-left: 2rpx;
}

.t2 {
	margin-top: 4rpx;
}

.t5 {
	margin-top: 10rpx;
}

.t7 {
	margin-top: 14rpx;
}

.t9 {
	margin-top: 18rpx;
}

.t10 {
	margin-top: 20rpx;
}
.t17{
	margin-top: 34rpx;
}
.t20 {
	margin-top: 72rpx;
}

.t324{
	margin-top: 648rpx;
}
.b1 {
	margin-right: 2rpx;
}

.b9 {
	margin-bottom: 18rpx;
}
.b10 {
	margin-bottom: 20rpx;
}
.b11 {
	margin-bottom: 22rpx;
}

.b12 {
	margin-bottom: 24rpx;
}

.b13 {
	margin-bottom: 26rpx;
}

::v-deep .van-tabbar-item{
	font-size: 20rpx;
	color: #666666;
}
::v-deep .van-tabbar-item--active{
    font-weight:bolder;
	font-size: 20rpx;
	color: #666666;
}
</style>
